#pragma once
#include "Container.h"
#include "Command.h"
#include "Effect.h"
#include "Event.h"

class ObjectManager;
class Object;
class ExamplePlugin;

template<> 
bool Container<Object>::Add(const Object &NewObject);
template<>
Object & Container<Object>::operator[](const Value& Index) const;
template<>
bool Container<Object>::RemoveAtIndex(const Value& Index);

template<> 
bool Container<Object*>::Add(Object &NewObject);
template<>
Object & Container<Object*>::operator[](const Value& Index) const;
template<>
bool Container<Object*>::RemoveAtIndex(const Value& Index);

class Object
{
public:
	Object(Object *NewParent = NULL);
	Object(const Object &Source);
	Container<Event> Events;
	Value &GetBaseAttribute(const Value &Name);
	Value GetModifiedAttribute(const Value &Name);
	Object & operator =(const Object &Source);
	Object & operator [](const Value &Index);
	friend ObjectManager;
	friend Container<Object>;
	friend Container<Object *>;
	static Value Error;
	Object *Parent;
	int GetIndex();
	Container<Object *> GetObjectsWithAttribute(const Value &Index);
	Container<Object *> GetObjectsWithAttributes(Container<Value> Indexs);
private:
	Container<Object *> Children;
	Container<Value> Attributes;
	Container<Effect> Effects;
	void Copy(const Object &Source);
	int Index;
};

